import { Column, Entity, OneToOne, PrimaryGeneratedColumn } from "typeorm";
import { PhotoMetadata } from "./photoMetadata.entity";
import { BaseEntity } from "./base.entity";

@Entity()
export class Photo extends BaseEntity {
  
  @PrimaryGeneratedColumn()
  id ?: number;

 
  @Column({
    type: "varchar"
  })
  name: string;

  @Column()
  description: string;

  @Column()
  filename: string;

  @Column()
  views: number;

  @Column()
  isPublished: boolean;

  @OneToOne(() => PhotoMetadata, photoMetadata => photoMetadata.photo, {
    cascade: true,
    eager: true
  })
  metadata: PhotoMetadata;
}